package com.example.demo.auth

import javax.servlet.http.HttpServletRequest

data class AuthorizationHeader(val schema:String,val parameter:String) {
    companion object {
        fun newAuthorizationHeader(request: HttpServletRequest):AuthorizationHeader?{
            val header = request.getHeader("Authorization")
            val split = header?.split(" ".toRegex())
            if(split?.size==2){
                return AuthorizationHeader(split[0],split[1])
            }
            return null
        }
    }
}